#!/bin/bash

nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
-c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
-hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index.m3u8 > ffmpeg.log 2>&1 &

ffmpeg \
  -timeout 5000000 \          # 超时设置（微秒）
  -tcp_transport tcp \        # 使用 TCP 传输（避免 UDP 丢包）
  -rtsp_transport tcp \       # RTSP over TCP
  -reconnect 1 \              # 启用自动重连
  -reconnect_at_eof 1 \       # 流结束时重连
  -reconnect_streamed 1 \     # 流式传输时重连
  -reconnect_delay_max 5 \    # 最大重连间隔（秒）
  -i "rtsp://10.0.0.17:8554/camera_test/2" \
  -c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 \
  -s 1280x720 -an \
  -loglevel warning \         # 日志级别调整为 warning（记录更多信息）
  -hls_time 4 -hls_list_size 2 -hls_flags delete_segments \
  -f hls /home/admin-root/haotian/缺陷检测/hls_data/index.m3u8

nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
-c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
-hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index1.m3u8 > ffmpeg.log 2>&1 &

nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
-c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
-hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index2.m3u8 > ffmpeg.log 2>&1 &

nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
-c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
-hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index3.m3u8 > ffmpeg.log 2>&1 &

nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
-c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
-hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index4.m3u8 > ffmpeg.log 2>&1 &

nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
-c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
-hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index5.m3u8 > ffmpeg.log 2>&1 &

nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
-c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
-hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index6.m3u8 > ffmpeg.log 2>&1 &

nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
-c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
-hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index7.m3u8 > ffmpeg.log 2>&1 &

nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
-c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
-hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index8.m3u8 > ffmpeg.log 2>&1 &

nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
-c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
-hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index9.m3u8 > ffmpeg.log 2>&1 &

nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
-c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
-hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index10.m3u8 > ffmpeg.log 2>&1 &

nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
-c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
-hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index11.m3u8 > ffmpeg.log 2>&1 &

nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
-c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
-hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index12.m3u8 > ffmpeg.log 2>&1 &

# nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
# -c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
# -hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index13.m3u8 > ffmpeg.log 2>&1 &

# nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
# -c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
# -hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index14.m3u8 > ffmpeg.log 2>&1 &

# nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
# -c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
# -hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index15.m3u8 > ffmpeg.log 2>&1 &

# nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
# -c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
# -hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index16.m3u8 > ffmpeg.log 2>&1 &


# nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
# -c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
# -hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index17.m3u8 > ffmpeg.log 2>&1 &

# nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
# -c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
# -hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index18.m3u8 > ffmpeg.log 2>&1 &

# nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
# -c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
# -hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index19.m3u8 > ffmpeg.log 2>&1 &

# nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
# -c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
# -hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index20.m3u8 > ffmpeg.log 2>&1 &

# nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
# -c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
# -hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index21.m3u8 > ffmpeg.log 2>&1 &

# nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
# -c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
# -hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index22.m3u8 > ffmpeg.log 2>&1 &

# nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
# -c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
# -hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index23.m3u8 > ffmpeg.log 2>&1 &

# nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
# -c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
# -hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index24.m3u8 > ffmpeg.log 2>&1 &

# nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
# -c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
# -hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index25.m3u8 > ffmpeg.log 2>&1 &

# nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
# -c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
# -hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index26.m3u8 > ffmpeg.log 2>&1 &


# nohup ffmpeg  -i "rtsp://10.0.0.17:8554/camera_test/2" \
# -c:v libx264 -b:v 500k -preset superfast -tune zerolatency -crf 23 -s 1280x720 -an -loglevel error \
# -hls_time 4 -hls_list_size 2 -hls_flags delete_segments -f hls /home/admin-root/haotian/缺陷检测/hls_data/index27.m3u8 > ffmpeg.log 2>&1 &



echo "FFmpeg 已后台启动，PID: $!"
